home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / WriteLn.data < prev    next >
Text File  |  1995-08-19  |  2KB  |  79 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. WriteLn = {
  5.  
  6.  
  7.     Short = {{ Write a line of text to a specified _Filehandle_ }};
  8.     description = {{
  9.     WriteLn is a bit superfluous, since all U can
  10.     do with it can easily - and perhaps better -
  11.     be achieved with the use of echo and output
  12.     redirection ('>>') (expect for the case, we
  13.     try to redirect to things like CON:...).
  14.  
  15.     WriteLn just copies a string to a filehandle that
  16.     was previousy opened with 'Open'; it is part of
  17.     the archive just for completeness: if we have a
  18.     open/close/read, everyone can also expect a 'write'.
  19.     ReadLn does no checks on the given filehandle, so
  20.     it should be used carefully.
  21.  
  22.     RESULT
  23.     -/-
  24.     }};
  25.  
  26.     Notes = {{
  27.     WriteLn is highly dangerous! Do not Use it,
  28.     if U do not exactly know what U are doing!
  29.     }};
  30.  
  31.     Examples = {{
  32.     > set fh `Open T:writetest WRITE`
  33.     > WriteLn $fh This is a test
  34.     > Close $fh
  35.     > Unset fh
  36.     > cat T:writetest
  37.       This is a test
  38.     }};
  39.  
  40.  
  41.     HISTORY = {{
  42.     21-02-95 b_noll created
  43.     21-02-95 b_noll added version/format-prefix/offset
  44.     20-03-95 b_noll added args diagnostics
  45.     20-03-95 b_noll fixed an error - writeln in fact never worked
  46.     19-08-95 b_noll created .data file
  47.     }};
  48.  
  49.     Template =    "FILEHANDLE/N/A,NOLINE/S,TEXT/F";
  50.     Arguments = {{
  51.     BPTR  *filehandle;
  52.     ULONG  noline;
  53.     STRPTR text;
  54.     }};
  55.  
  56.     version =  "1.1";
  57.     body = {{
  58.  
  59.         if (argv->filehandle && *argv->filehandle) {
  60.  
  61.         /* MISSING: CHECKREGISTER(*argv->filehandle); */
  62.  
  63.         if (FPrintf(*argv->filehandle, argv->noline? "%s": "%s\n", argv->text) >= 0) {
  64.             if (!argv->noline || Flush (*argv->filehandle))
  65.             retval = RETURN_OK;
  66.         } else {
  67.             //PrintFault(IoErr(), "WRITE");
  68.         } /* if */
  69.         } else {
  70.         //PrintFault(ERROR_BAD_NUMBER, "WRITE");
  71.         SetIoErr(ERROR_BAD_NUMBER);
  72.         } /* if */
  73.  
  74.     }};
  75. };
  76.  
  77. #endif
  78.  
  79.